def is_perfect_number(n):
    ysum=0#记录因数和
    for x in range(1,n//2+1):#注意range函数参数只能是整数
        if n%x==0:
            ysum+=x
    return ysum==n


def main():
    line = input().split()
    n = int(line[0])
    m = int(line[1])
    flag = False
    for i in range(n, m + 1):
        if is_perfect_number(i):
            flag = True
            print(i, end=' ')
    if not flag:
        print(0)


main()
